<template>
	<div>
		<h5>孙组件接受参数</h5>
		<div>1.祖父组件定义provide，孙组件inject接受：{{location}}</div>
		<p>用户信息： {{userInfos.username}}</p>
		<br />
		<br />
		<div>2.provide inject实现父子组件传值的时候，子组件改变数据也会影响父组件</div>
		<br />姓名：
		<input v-model="userInfos.username" />
	</div>
</template>

<script>
import { ref, inject } from "vue";
export default {
	setup() {
		let location = inject("location");
		let userInfos = inject("userInfos");
		return {
			location,
			userInfos
		};
	}
};
</script>

<style>
</style>